<?php
/**
 * @package Joomla
 * @subpackage Jmonoslideshow
 * @copyright (C) 2010 - Matthieu BARBE - www.ccomca.com
 * @license GNU/GPL v2
 * 
 * Jmonoslideshow is a Joomla extension for album.
 *
 * Jmonoslideshow uses :
 * album (http://www.monoslideshow.com/)
 * Plupload (http://www.plupload.com/) by Moxicode Systems
 * json class by Michal Migurski, Matt Knapp, Brett Stimmerman
 * jquery a JavaScript Library (http://jquery.com/)
 * getid3 library (http://getid3.sourceforge.net/)
 * swfobject is an easy-to-use and standards-friendly method to embed Flash content, which utilizes one small JavaScript file (http://code.google.com/p/swfobject/)
 * Chained Selects jQuery Plugin (http://www.appelsiini.net/2010/jquery-chained-selects)
 *
 * Jmonoslideshow is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');

/**
 * HTML View class for the model controller
 *
 * @package    album
 * @subpackage Views
 */

class JmonoslideshowViewModel extends JView
{
	/**
	 * model view display method
	 *
	 * @return void
	 **/
	function display($tpl = null)
	{
		$option = JRequest::getCmd('option');
		
		
		// activate the tooltips
		JHTML::_('behavior.tooltip');

		//get the model
		$model	=& $this->get('Data');
		$isNew = ($model->id < 1);

		$text = $isNew ? JText::_( 'COM_JMONOSLIDESHOW_NEW' ) : JText::_( 'COM_JMONOSLIDESHOW_EDIT' );
		JToolBarHelper::title(  'Model: <small><small>[ ' . $text.' ]</small></small>', 'model' );
		JToolBarHelper::save();
		JToolBarHelper::apply();
		if ($isNew)  {
			JToolBarHelper::cancel();
		} else {
			// for existing items the button is renamed `close`
			JToolBarHelper::cancel( 'cancel', JText::_('COM_JMONOSLIDESHOW_CLOSE') );
			
		}

		$lists = array();

		if (!$isNew)
			{
			$lists['published'] = JHTML::_('select.booleanlist', 'published', '', $model->published);
			}
		
		// get params definitions
		$lang =& JFactory::getLanguage();
		$extension = 'com_jmonoslideshow';
		$base_dir = JPATH_SITE;
		$lang->load($extension, $base_dir, '', true);
		
		$file 	= JPATH_COMPONENT.DS.'models'.DS.'model.xml';
		if (!$isNew) $params = new JParameter( $model->params, $file ); else $params = new JParameter( '', $file );
		
		
		$this->assignRef('pane',		 $pane);
		$this->assignRef('model', 		$model);
		$this->assignRef('lists',		$lists);
		$this->assignRef('isNew',		$isNew);
		$this->assignRef('params',		$params);

		parent::display($tpl);
	}// function
	

}// class
